/*##############################################################################

	Name	: ATTINY26 Motor driver - I2C via USI-TWI, TB6612FNG
	Version	: 0.1  - alpha
	autor	: Odo Maletzki odo@maletzki.net
	page	: www.maletzki.net
	License	: GNU General Public License 


    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details

//############################################################################*/


#include 	<stdlib.h>
#include 	<avr/io.h>
#include 	<avr/interrupt.h>
#include 	<avr/pgmspace.h>

#include "i2cbar.h"


void i2cBarSetup(void) {
	cli();  // Disable interrupts

	timer0Init();	
	
	btnSetup();
	buzzerSetup();
	ledSetup();
	pingSetup();
	irBarSetup();
	USI_init(SLAVE_ADDR_ATTINY);

	sei();  // Re-enable interrupts
	
	
}



int main(void)
{	
	i2cBarSetup();
	while(1) 
    {
		buzzerLoop();
		pingLoop();
		irBarLoop();
	} 
} 



